# $Id$
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>

pkgname=libindi
pkgver=1.5.0
pkgrel=1
pkgdesc="A distributed control protocol designed to operate astronomical instrumentation"
url="http://www.indilib.org/index.php?title=Main_Page"
license=(GPL2)
arch=(i686 x86_64)
depends=(libnova cfitsio libusb libjpeg gsl curl)
makedepends=(cmake boost qt5-base)
#source=("https://github.com/indilib/indi/releases/download/v$pkgver/libindi_$pkgver.tar.gz")
source=($pkgname-$pkgver.tar.gz::"https://github.com/indilib/indi/archive/v$pkgver.tar.gz")
sha256sums=('ec955968aea471c97e00b2476736b0e446844efa7749bf5eb878f8f7c0e46f4c')

prepare() {
  mkdir -p build

  sed -e 's|GROUP="plugdev", MODE="0666"|TAG+="uaccess"|' -i indi-$pkgver/libindi/drivers/*/*.rules
}

build() {
  cd build
  cmake ../indi-$pkgver/libindi \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DUDEVRULES_INSTALL_DIR=/usr/lib/udev/rules.d
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
